<?php

declare (strict_types=1);
namespace App\Dao;


use App\Kernel\Traits\DaoTrait;
use App\Model\Logistic;

class LogisticDao extends Dao
{
    use DaoTrait;


    /**
     * @var
     */
    private $logistics;
    /**
     * Get model.
     *
     * @return string
     */
    public function model(): string
    {
        return Logistic::class;
    }

    /**
     * 获得快递数量
     * @param string $order_no
     * @return int
     */
    public function logisticCount(string $order_no)
    {
        return Logistic::query()->where('order_no', $order_no)->count();
    }

    /**
     * 通过订单编号获得当前的物流信息
     * @param string $order_no
     * @return mixed
     */
    public function getLogisticByOrderNo(string $order_no)
    {
        return Logistic::query()->where('order_no', $order_no)->first();
    }

    /**
     * 通过快递编号获得当前物流信息
     * @param string $number
     * @return mixed
     */
    public function getLogisticByNumber(string $number)
    {
        return Logistic::query()->where('number', $number)->first();
    }

}